#include"process.h"
#include<stdlib.h>
#include<time.h>
#define TOTAL 100000

typedef void (*recallfuc)(double,double);

void download2(recallfuc bc)
{   
    printf("第二版本\n");
    srand(time(0));
    int rate[TOTAL];
    for(int i = 0;i<TOTAL;i++)
        rate[i] = rand()%1000 + 1;
    for(int i = 0;i<TOTAL;i++)
    {
        bc(i*1.0,TOTAL*1.0);
        fflush(stdout);
        usleep(rate[i]);
    }
    printf("\n");
    printf("finish download highest rate:10000 TOTAL:%d\n",TOTAL);
}


int main()
{
    printf("Hello Linux\n");
    printf("这是一个进度条测试\n");
    printf("第一版本\n");
    process_v1();
    download2(process_v2);    
   return 0;
}

